/**
 * @author dream
 * @date 2021/1/2 22:31
 */
public class SortingResultInfo implements Comparable<SortingResultInfo> {
    private String name;
    /**
     * 获取开始时间
     */
    private long startTime;
    /**
     * 获取结束时间
     */
    private long endTime;


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setStartTime(long startTime) {
        this.startTime = startTime;
    }

    public void setEndTime(long endTime) {
        this.endTime = endTime;
    }

    public long getWhen() {
        return endTime - startTime;
    }

    @Override
    public int compareTo(SortingResultInfo o) {
        return (int) (this.getWhen() - o.getWhen());
    }

    @Override
    public String toString() {
        return getName() + "  用时：" + getWhen() + "ms\t";
    }
}